package exportimporterentities;

import java.util.ArrayList;
import java.util.List;

import api.entitites.IGarage;
import api.entitites.IMaster;
import api.entitites.IOrder;
import api.exportimportentities.IExportImportEntities;
import api.messages.Messager;

public class ExportImportEntities implements IExportImportEntities {

	private ArrayList<String> arrayMessanger = new ArrayList<String>();
	

	private Export exporter = new Export();
	private Import importer = new Import();

	public void ExportGarages(List<IGarage> garageList) {
		arrayMessanger.clear();
		try {
			exporter.exportGarage(garageList);
			arrayMessanger.add(Messager.EXPORT);
		} catch (RuntimeException e) {
			arrayMessanger.add(e.getMessage());
		}
		
	}

	public void ExportMasters(List<IMaster> masterList) {
		arrayMessanger.clear();
		try {
			exporter.exportMaster(masterList);
			arrayMessanger.add(Messager.EXPORT);
		} catch (RuntimeException e) {
			arrayMessanger.add(e.getMessage());
		}
		
	}

	public void ExportOrders(List<IOrder> orderList) {
		arrayMessanger.clear();
		try {
			exporter.exportOrder(orderList);
			arrayMessanger.add(Messager.EXPORT);
		} catch (RuntimeException e) {
			arrayMessanger.add(e.getMessage());
		}
		
		

	}

	public ArrayList<IGarage> ImportGarages() {
		
			return importer.getGarages();
		
	}

	public ArrayList<IMaster> ImportMasters() {
		
		return importer.getMasters();
			
		
	}

	public ArrayList<IOrder> ImportOrders() {
		return importer.getOrders();
			
	}

}
